﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace HigLabo.Net.Twitter
{
    public partial class TwitterClient
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="placeName"></param>
        /// <param name="latitude"></param>
        /// <param name="longitude"></param>
        /// <param name="callback"></param>
        public void GetGeoSimilarPlaces(String placeName, Double latitude, Double longitude, Action<Places> callback)
        {
            GetGeoSimilarPlacesCommand command = new GetGeoSimilarPlacesCommand() { Name = placeName, Latitude = latitude, Longitude = longitude };
            GetGeoSimilarPlaces(command, callback);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <param name="callback"></param>
        public void GetGeoSimilarPlaces(GetGeoSimilarPlacesCommand command, Action<Places> callback)
        {
            this.GetResultText(TwitterApiUrl.Version1_1.Geo.GetGeoSimilarPlacesUrl, command, json => callback(new Places(json)));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <param name="callback"></param>
        public void GetGeoSearch(GetGeoSearchCommand command, Action<Places> callback)
        {
            this.GetResultText(TwitterApiUrl.Version1_1.Geo.GetGeoSearchUrl, command, json => callback(new Places(json)));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="latitude"></param>
        /// <param name="longitude"></param>
        /// <param name="callback"></param>
        public void GetGeoReverseGeoCode(Double latitude, Double longitude, Action<Places> callback)
        {
            GetReverseGeoCodeCommand command = new GetReverseGeoCodeCommand() { Latitude = latitude, Longitude = longitude };
            GetGeoReverseGeoCode(command, callback);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <param name="callback"></param>
        public void GetGeoReverseGeoCode(GetReverseGeoCodeCommand command, Action<Places> callback)
        {
            this.GetResultText(TwitterApiUrl.Version1_1.Geo.GetGeoReverseGeoCodeUrl, command, json => callback(new Places(json)));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="placeID"></param>
        /// <param name="callback"></param>
        public void GetGeoPlace(String placeID, Action<Place> callback)
        {
            GetGeoPlaceCommand command = new GetGeoPlaceCommand() { PlaceID = placeID };
            GetGeoPlace(command, callback);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <param name="callback"></param>
        public void GetGeoPlace(GetGeoPlaceCommand command, Action<Place> callback)
        {
            this.GetResultText(TwitterApiUrl.Version1_1.Geo.GetGeoPlaceByIDUrl, command, json => callback(new Place(json)));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="parentPlaceID"></param>
        /// <param name="token"></param>
        /// <param name="latitude"></param>
        /// <param name="longitude"></param>
        /// <param name="callback"></param>
        public void CreateGeoPlace(String name, String parentPlaceID, String token, Double latitude, Double longitude, Action<Place> callback)
        {
            PostGeoPlaceCommand command = new PostGeoPlaceCommand()
            {
                Name = name,
                ContainedWithin = parentPlaceID,
                Token = token,
                Latitude = latitude,
                Longitude = longitude
            };
            this.CreateGeoPlace(command, callback);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <param name="callback"></param>
        public void CreateGeoPlace(PostGeoPlaceCommand command, Action<Place> callback)
        {
            this.GetResultText(TwitterApiUrl.Version1_1.Geo.PostGeoPlaceUrl, command, json => callback(new Place(json)));
        }
    }
}
